<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/8 0008
 * Time: 16:01
 */

namespace app\api\controller\v1;


use library\Controller;
use think\App;
use think\Db;

/**
 * 地址类
 * Class Address
 * @package app\api\controller\v1
 */
class Address extends Controller
{
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    public function index()
    {
        echo 'address';
    }

    /**
     * 获取所有下级
     * @param $id
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function read($id)
    {
        is_numeric($id) || $id=1;
        $list = Db::name('Cities')->where('pid',$id)->select();
        $this->success('获取地址成功！',$list);
    }
}